<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>AddStu</title>
<script src="../jquery-3.5.1.js"></script>
<script src="../jquery.cookie.js"></script>
<script>var userid = sessionStorage.getItem('testKey');
if(userid == null || userid == "")
	{
	window.location = "/login.html";
	}
</script>
<script type="text/javascript">
function addStu(){
	
	var data = $('#add').serialize();
	console.log(data);
	$.post('/students',data,function(data){
		if(data=="success")
			{
			alert("添加成功");
			 history.back(-1);
			}
		else{
			alert("添加失败");
		}
		
	})
}
</script>
<style>
body
{
font-size:75%;
font-family:verdana,arial,'sans serif';

background-repeat:repeat-x;
background-color:#FFFFF0;
color:#000080;

}

h1 {font-size:200%;}
h2 {font-size:140%;}
h3 {font-size:110%;}

th {background-color:#ADD8E6;}

ul {list-style:circle;}
ol {list-style:upper-roman;}

a:link {color:#000080;}
a:hover {color:red;}

</style>

</head>
<body>
	<em>请填写要增加的学生信息</em>
	<form method="post" action="/students" id="add">
		<table>
			<tr>
				<td>学号</td>
				<td><input type="text" name="sid" /></td>
			</tr>
			<tr>
				<td>姓名</td>
				<td><input type="text" name="name" /></td>
			</tr>
			<tr>
				<td>性别</td>
				<td><input name="gender" type="radio" value="男" checked />男 <input
					name="gender" type="radio" value="女" />女</td>
			</tr>
			<tr>
				<td>生日</td>
				<td><input type="Date" name="birthday" /></td>
			</tr>
			<tr>
				<td>密码</td>
				<td><input type="text" name="password" /></td>
			</tr>
			<tr>
				<td><button type="button" onclick="addStu()">添加学生</button></td>
			</tr>
		</table>
	</form>
</body>
</html>